 <!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> 新闻公告列表</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <include file="common_css"/>
    <link href="__PUBLIC__/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <!--分页样式-->
    <style type="text/css">
        div.green-black{padding:3px;margin:3px;text-align:center;}
        div.green-black a{border:#2c2c2c 1px solid;padding:2px 5px;background:#2c2c2c;color:#fff;margin:0 2px 0 0;text-decoration:none;}
        div.green-black a:hover{border: #23b7e5 1px solid;background: #23b7e5;color:#fff;}
        div.green-black a:active{border: #23b7e5 1px solid;background: #23b7e5;color:#fff;}
        div.green-black span.current{border: #23b7e5 1px solid;padding:2px 5px;font-weight:bold;background:#23b7e5;color:#fff;margin:0 2px 0 0;}
        div.green-black span.disabled{border:#f3f3f3 1px solid;padding:2px 5px;color:#ccc;margin:0 2px 0 0;}
    </style>
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>新闻公告列表</h5>
                        <a class="btn btn-sm btn-success" style="float: right;margin-bottom: 3px;" href="javascript:location.replace(location.href);" title="刷新" >
                            <i class="fa fa-refresh"></i> </a>
                    </div>
                    <div class="ibox-content">
                        <div class="row">
                            <div class="col-sm-1 m-b-xs">
                                <a  href="article_Add.html" class="btn btn-w-m btn-success">添加</a>
                            </div>
                        </div>
                        <div class="row">
                            <form method="post" action="__MODULE__/Index/articleList" >
                            <div class="col-sm-2 m-b-xs">
                                <select name="type" class="input-sm form-control input-s-sm inline">
                                    <option value="0">全部</option>
                                    <option value="1" <if condition="$type eq 1">selected="selected"</if>>新闻</option>
                                    <option value="2" <if condition="$type eq 2">selected="selected"</if>>公告</option>
                                </select>
                            </div>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input type="text" name="title" value="{$title}" placeholder="请输入文章标题关键词" class="input-sm form-control">
                                    <span class="input-group-btn">
                                        <button type="submit" class="btn btn-sm btn-primary">搜索</button>
                                    </span>
                                </div>
                            </div>
                        </form>
                        </div>

                        <div class="table-responsive">
                            <table class="table table-striped">
                                <thead>
                                    <tr>
                                        <th></th>
                                        <!--<th>ID</th>-->
                                        <th>日期</th>
                                        <th>标题</th>
                                        <th>类型</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                <foreach name="data" item="data">
                                    <tr>
                                        <td></td>
                                        <!--<td>{$data.id}</td>-->
                                        <td>{$data.add_time|date="Y-m-d H:i:s",###}</td>
                                        <td>{$data.title}</td>
                                        <td><if condition="$data.type eq 1">公告<elseif condition="$data.type eq 2"/>资讯<else/>新闻</if></td>
                                        <td>
                                            <a href="javascript:;" onclick="article_save('编辑','__MODULE__/Index/article_save/id/{$data.id}',1200,700);"><i class="fa fa-search-plus text-navy"></i></a>
                                            <a href="javascript:;" onclick="article_delete(this,'{$data.id}');"><i class="fa fa-trash text-navy"></i></a>
                                        </td>
                                    </tr>
                                </foreach>
                                </tbody>
                            </table>
                            <div class="green-black">{$page}</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- 全局js -->
    <include file="common_js"/>
    <!-- Peity -->
    <script src="__PUBLIC__/admin/js/plugins/peity/jquery.peity.min.js"></script>
    <!-- 自定义js -->
    <script src="__PUBLIC__/admin/js/content.js?v=1.0.0"></script>
    <script src="__PUBLIC__/common/js/layer_show.js"></script>
    <!-- iCheck -->
    <script src="__PUBLIC__/admin/js/plugins/iCheck/icheck.min.js"></script>
    <!-- Peity -->
    <script src="__PUBLIC__/admin/js/demo/peity-demo.js"></script>
    <script>
        $(document).ready(function () {
            $('.i-checks').iCheck({
                checkboxClass: 'icheckbox_square-green',
                radioClass: 'iradio_square-green',
            });
        });

        function article_save(title,url,w,h) {
            layer_show(title,url,w,h);
        }



        function article_delete(obj,id) {
            layer.confirm('确认删除吗？', function () {
                if (id == '') {
                    layer.msg("error：404");
                    return;
                } else {
                    $.post('__MODULE__/Index/article_delete', {id: id}, function (data) {
                        layer.msg(data.msg);
                        if (data.status==1) {
                            $(obj).parents("tr").remove();
                        }
                    })
                }
            })
        }




    </script>
</body>
</html>
